<template>
  <view class="container" :style="{ backgroundImage: `url(${counterStore.bg_img})` }">
    <!-- 顶部占位，用于适配安全区域 -->
    <view class="navbar" :style="{ paddingTop: safeAreaInsets?.top + 'px' }">
      <view class="back-button" @tap="goBack">
        <text class="back-icon">←</text>
      </view>
    </view>

    <!-- 内容区域 -->
    <view class="content">
      <!-- 说明部分 -->
      <view class="description">
        <text class="title">身心灵牌阵</text>
        <text class="subtitle">适用于那些希望获取不同意识层面信息的场合，常用于日常占卜，帮助分析个人的身体、心理和精神状态。</text>
      </view>

      <!-- 问题示例部分 -->
      <view class="examples">
        <text class="example-title">模向示例：</text>
        <view class="example-list">
          <text class="example-item">我目前的身心灵状态如何？</text>
          <text class="example-item">我近期最需要注意哪个层面？</text>
          <text class="example-item">我如何提升自己的整体能量？</text>
        </view>
      </view>

      <!-- 牌阵说明部分 -->
      <view class="spread-info">
        <text class="spread-title">身心灵牌阵通常由三张牌组成，分别代表身体、心理和精神三个层面。</text>
        <view class="spread-details">
          <text class="detail-item">第一位：代表身体（身），反映当前的身体状况或事件对身体的影响。</text>
          <text class="detail-item">第二位：代表心理（心），表示心理状态或事件对心理的影响。</text>
          <text class="detail-item">第三位：代表精神（灵），表示精神状态或事件对精神层面的影响。</text>
          <text class="detail-item">切牌：表示问卜者主观的想法。</text>
        </view>
      </view>

      <!-- 开始按钮 -->
      <view class="start-button" @tap="startReading">
        开始抽牌
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import {useCounterStore} from '@/store/counter'

const counterStore = useCounterStore()

// 获取屏幕边界到安全区域距离
const { safeAreaInsets } = uni.getSystemInfoSync()

// 返回上一页
const goBack = () => {
  uni.navigateBack()
}

// 开始抽牌
const startReading = () => {
  uni.navigateTo({
    url: '../card-select/card-select?count=3',
    fail: (err) => {
      console.error('跳转失败:', err)
      uni.showToast({
        title: '页面跳转失败',
        icon: 'none'
      })
    }
  })
}
</script>

<style scoped>
.container {
  min-height: 100vh;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
}

.navbar {
  height: 12vw;
  display: flex;
  align-items: center;
  padding: 0 4vw;
}

.back-button {
  position: relative;
  width: 8vw;
  height: 8vw;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 50%;
}

.back-icon {
  color: #fff;
  font-size: 5vw;
}

.content {
  padding: 4vw;
}

.description {
  margin-bottom: 6vw;
}

.title {
  font-size: 4.8vw;
  font-weight: bold;
  margin-bottom: 3vw;
  display: block;
}

.subtitle {
  font-size: 3.2vw;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  display: block;
}

.examples {
  margin-bottom: 6vw;
  background: rgba(255, 255, 255, 0.1);
  padding: 3vw;
  border-radius: 2vw;
}

.example-title {
  color: #ff6b6b;
  font-size: 3.2vw;
  margin-bottom: 2vw;
  display: block;
}

.example-list {
  display: flex;
  flex-direction: column;
  gap: 2vw;
}

.example-item {
  font-size: 3.2vw;
  color: rgba(255, 255, 255, 0.9);
}

.spread-info {
  margin-bottom: 6vw;
}

.spread-title {
  font-size: 3.2vw;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 3vw;
  display: block;
}

.spread-details {
  background: rgba(255, 255, 255, 0.1);
  padding: 3vw;
  border-radius: 2vw;
  display: flex;
  flex-direction: column;
  gap: 2vw;
}

.detail-item {
  font-size: 3.2vw;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

.start-button {
  height: 12vw;
  background: linear-gradient(90deg, #27ba9b 0%, #1f9d82 100%);
  border-radius: 6vw;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.6vw;
  color: #fff;
  font-weight: bold;
  margin-top: 8vw;
}

.start-button:active {
  opacity: 0.8;
}
</style> 